import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '生日',
    align: "center",
    dataIndex: 'birthday',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '体重',
    align: "center",
    dataIndex: 'bodyWeight'
  },
  {
    title: '存款',
    align: "center",
    dataIndex: 'money'
  },
  {
    title: '上班',
    align: "center",
    dataIndex: 'onWork'
  },
  {
    title: '年龄',
    align: "center",
    dataIndex: 'age'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "生日",
    field: "birthday",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "体重",
    field: "bodyWeight",
    component: 'JRangeNumber',
    colProps: {span: 6},
  },
  {
    label: "存款",
    field: 'money',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
  },
  {
    label: '生日',
    field: 'birthday',
    component: 'DatePicker',
  },
  {
    label: '体重',
    field: 'bodyWeight',
    component: 'InputNumber',
  },
  {
    label: '存款',
    field: 'money',
    component: 'InputNumber',
  },
  {
    label: '上班',
    field: 'onWork',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '年龄',
    field: 'age',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
